package com.bkgy.modular.calsidata.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baosight.hdjni.HDErrcode;
import com.baosight.hdsdk.domain.data.HDDataConnection;
import com.bkgy.modular.calsidata.dao.TbDsjC621EdgePassTimeDao;
import com.bkgy.modular.calsidata.dao.TbDsjC622FlatPassTimeMapper;
import com.bkgy.modular.calsidata.entity.TbDsjC621EdgePassTime;
import com.bkgy.modular.calsidata.entity.TbDsjC622FlatPassTime;
import com.bkgy.sys.common.entity.ResultData;
import com.bkgy.util.SDKUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;

@Slf4j
@Service
public class TbDsjC621EdgePassTimeService {

    @Resource
    TbDsjC621EdgePassTimeDao tbDsjC621EdgePassTimeDao;

    @Resource
    TbDsjC622FlatPassTimeMapper tbDsjC622FlatPassTimeMapper;

    @Resource
    private SDKUtils sdkUtils;

    /**
     * 时间序列
     *
     * @param json
     * @return
     */
    public ResultData getTimeSeriesData(JSONObject json) {
        // 获取coil_id
        String coil_id = json.getString("coil_id");

        // 创建查询条件 传入coil_id和表中数据相同的满足条件
        LambdaQueryWrapper<TbDsjC621EdgePassTime> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(TbDsjC621EdgePassTime::getCoil_id, coil_id);

        // 调用dao方法进行查询
        List<TbDsjC621EdgePassTime> tbDsjC621EdgePassTimeList = tbDsjC621EdgePassTimeDao.selectList(queryWrapper);

        // 获取sdkUtils连接
        HDDataConnection dataConn = sdkUtils.getConnect();
        while (!dataConn.isConnected()) {
            dataConn = sdkUtils.getConnect();
        }
        // findTagId 根据变量名查找tagId
        Integer tagId = sdkUtils.findTagId("C621_exit_thick1", dataConn.getTagManager());
        Integer tagId2 = sdkUtils.findTagId("C621_WSHAPEFB01", dataConn.getTagManager());
        Integer tagId3 = sdkUtils.findTagId("C621_WSHAPEFB02", dataConn.getTagManager());
        Integer tagId4 = sdkUtils.findTagId("C621_WSHAPEFB03", dataConn.getTagManager());
        Integer tagId5 = sdkUtils.findTagId("C621_WSHAPEFB04", dataConn.getTagManager());
        Integer tagId6 = sdkUtils.findTagId("C621_WSHAPEFB05", dataConn.getTagManager());
        Integer tagId7 = sdkUtils.findTagId("C621_WSHAPEFB06", dataConn.getTagManager());
        Integer tagId8 = sdkUtils.findTagId("C621_WSHAPEFB07", dataConn.getTagManager());
        Integer tagId9 = sdkUtils.findTagId("C621_WSHAPEFB08", dataConn.getTagManager());
        Integer tagId10 = sdkUtils.findTagId("C621_WSHAPEFB09", dataConn.getTagManager());
        Integer tagId11 = sdkUtils.findTagId("C621_WSHAPEFB10", dataConn.getTagManager());
        Integer tagId12 = sdkUtils.findTagId("C621_WSHAPEFB11", dataConn.getTagManager());
        Integer tagId13 = sdkUtils.findTagId("C621_WSHAPEFB12", dataConn.getTagManager());
        Integer tagId14 = sdkUtils.findTagId("C621_WSHAPEFB13", dataConn.getTagManager());
        Integer tagId15 = sdkUtils.findTagId("C621_WSHAPEFB14", dataConn.getTagManager());
        Integer tagId16 = sdkUtils.findTagId("C621_WSHAPEFB15", dataConn.getTagManager());
        Integer tagId17 = sdkUtils.findTagId("C621_WSHAPEFB16", dataConn.getTagManager());
        Integer tagId18 = sdkUtils.findTagId("C621_WSHAPEFB17", dataConn.getTagManager());
        Integer tagId19 = sdkUtils.findTagId("C621_WSHAPEFB18", dataConn.getTagManager());
        Integer tagId20 = sdkUtils.findTagId("C621_WSHAPEFB19", dataConn.getTagManager());
        Integer tagId21 = sdkUtils.findTagId("C621_WSHAPEFB20", dataConn.getTagManager());
        Integer tagId22 = sdkUtils.findTagId("C621_WSHAPEFB21", dataConn.getTagManager());
        Integer tagId23 = sdkUtils.findTagId("C621_WSHAPEFB22", dataConn.getTagManager());
        Integer tagId24 = sdkUtils.findTagId("C621_WSHAPEFB23", dataConn.getTagManager());
        Integer tagId25 = sdkUtils.findTagId("C621_WSHAPEFB24", dataConn.getTagManager());
        Integer tagId26 = sdkUtils.findTagId("C621_WSHAPEFB25", dataConn.getTagManager());
        Integer tagId27 = sdkUtils.findTagId("C621_WSHAPEFB26", dataConn.getTagManager());
        Integer tagId28 = sdkUtils.findTagId("C621_WSHAPEFB27", dataConn.getTagManager());
        Integer tagId29 = sdkUtils.findTagId("C621_WSHAPEFB28", dataConn.getTagManager());
        Integer tagId30 = sdkUtils.findTagId("C621_WSHAPEFB29", dataConn.getTagManager());
        Integer tagId31 = sdkUtils.findTagId("C621_WSHAPEFB30", dataConn.getTagManager());
        Integer tagId32 = sdkUtils.findTagId("C621_WSHAPEFB31", dataConn.getTagManager());
        Integer tagId33 = sdkUtils.findTagId("C621_VM_MDV_01_4VFB", dataConn.getTagManager());


          List<Double> C621_exit_thick1List = new ArrayList<>();
          List<Double> C621_WSHAPEFB01list = new ArrayList<>();
          List<Double> C621_WSHAPEFB02list = new ArrayList<>();
          List<Double> C621_WSHAPEFB03list = new ArrayList<>();
          List<Double> C621_WSHAPEFB04list = new ArrayList<>();
          List<Double> C621_WSHAPEFB05list = new ArrayList<>();
          List<Double> C621_WSHAPEFB06list = new ArrayList<>();
          List<Double> C621_WSHAPEFB07list = new ArrayList<>();
          List<Double> C621_WSHAPEFB08list = new ArrayList<>();
          List<Double> C621_WSHAPEFB09list = new ArrayList<>();
          List<Double> C621_WSHAPEFB10list = new ArrayList<>();
          List<Double> C621_WSHAPEFB11list = new ArrayList<>();
          List<Double> C621_WSHAPEFB12list = new ArrayList<>();
          List<Double> C621_WSHAPEFB13list = new ArrayList<>();
          List<Double> C621_WSHAPEFB14list = new ArrayList<>();
          List<Double> C621_WSHAPEFB15list = new ArrayList<>();
          List<Double> C621_WSHAPEFB16list = new ArrayList<>();
          List<Double> C621_WSHAPEFB17list = new ArrayList<>();
          List<Double> C621_WSHAPEFB18list = new ArrayList<>();
          List<Double> C621_WSHAPEFB19list = new ArrayList<>();
          List<Double> C621_WSHAPEFB20list = new ArrayList<>();
          List<Double> C621_WSHAPEFB21list = new ArrayList<>();
          List<Double> C621_WSHAPEFB22list = new ArrayList<>();
          List<Double> C621_WSHAPEFB23list = new ArrayList<>();
          List<Double> C621_WSHAPEFB24list = new ArrayList<>();
          List<Double> C621_WSHAPEFB25list = new ArrayList<>();
          List<Double> C621_WSHAPEFB26list = new ArrayList<>();
          List<Double> C621_WSHAPEFB27list = new ArrayList<>();
          List<Double> C621_WSHAPEFB28list = new ArrayList<>();
          List<Double> C621_WSHAPEFB29list = new ArrayList<>();
          List<Double> C621_WSHAPEFB30list = new ArrayList<>();
          List<Double> C621_WSHAPEFB31list = new ArrayList<>();
          List<Double> C621_WSHAPEFB32list = new ArrayList<>();
          List<Double> C621_WSHAPEFB33list = new ArrayList<>();


        Map<String,Object> map = new HashMap<>();

        // 遍历tbDsjC621EdgePassTimeList集合拿到所有数据
        for (TbDsjC621EdgePassTime tbDsjC621EdgePassTime : tbDsjC621EdgePassTimeList) {

            LocalDateTime startTime = tbDsjC621EdgePassTime.getPass_device_start_time().toLocalDateTime();
            LocalDateTime endTime = tbDsjC621EdgePassTime.getPass_device_end_time().toLocalDateTime();

            map.put("start_time",startTime);
            map.put("end_Time",endTime);
            HDErrcode hdErrcode = new HDErrcode();

            // findMsgByIdAndTime 查询一段时间内 对应tagID的值
            C621_exit_thick1List = sdkUtils.findQueryTagHisInterRecords(tagId, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB01list = sdkUtils.findQueryTagHisInterRecords(tagId2, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB02list = sdkUtils.findQueryTagHisInterRecords(tagId3, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB03list = sdkUtils.findQueryTagHisInterRecords(tagId4, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB04list = sdkUtils.findQueryTagHisInterRecords(tagId5, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB05list = sdkUtils.findQueryTagHisInterRecords(tagId6, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB06list = sdkUtils.findQueryTagHisInterRecords(tagId7, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB07list = sdkUtils.findQueryTagHisInterRecords(tagId8, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB08list = sdkUtils.findQueryTagHisInterRecords(tagId9, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB09list = sdkUtils.findQueryTagHisInterRecords(tagId10, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB11list = sdkUtils.findQueryTagHisInterRecords(tagId11, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB12list = sdkUtils.findQueryTagHisInterRecords(tagId12, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB13list = sdkUtils.findQueryTagHisInterRecords(tagId13, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB14list = sdkUtils.findQueryTagHisInterRecords(tagId14, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB15list = sdkUtils.findQueryTagHisInterRecords(tagId15, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB16list = sdkUtils.findQueryTagHisInterRecords(tagId16, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB17list = sdkUtils.findQueryTagHisInterRecords(tagId17, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB18list = sdkUtils.findQueryTagHisInterRecords(tagId18, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB19list = sdkUtils.findQueryTagHisInterRecords(tagId19, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB20list = sdkUtils.findQueryTagHisInterRecords(tagId20, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB21list = sdkUtils.findQueryTagHisInterRecords(tagId21, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB22list = sdkUtils.findQueryTagHisInterRecords(tagId22, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB23list = sdkUtils.findQueryTagHisInterRecords(tagId23, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB24list = sdkUtils.findQueryTagHisInterRecords(tagId24, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB25list = sdkUtils.findQueryTagHisInterRecords(tagId25, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB26list = sdkUtils.findQueryTagHisInterRecords(tagId26, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB27list = sdkUtils.findQueryTagHisInterRecords(tagId27, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB28list = sdkUtils.findQueryTagHisInterRecords(tagId28, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB29list = sdkUtils.findQueryTagHisInterRecords(tagId29, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB30list = sdkUtils.findQueryTagHisInterRecords(tagId30, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB31list = sdkUtils.findQueryTagHisInterRecords(tagId31, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB32list = sdkUtils.findQueryTagHisInterRecords(tagId32, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C621_WSHAPEFB33list = sdkUtils.findQueryTagHisInterRecords(tagId33, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
        }

        Collections.reverse(C621_exit_thick1List);
        map.put("C621_exit_thick1",C621_exit_thick1List);

        Collections.reverse(C621_WSHAPEFB01list);
        map.put("C621_WSHAPEFB01",C621_WSHAPEFB01list);

        Collections.reverse(C621_WSHAPEFB02list);
        map.put("C621_WSHAPEFB02",C621_WSHAPEFB02list);

        Collections.reverse(C621_WSHAPEFB03list);
        map.put("C621_WSHAPEFB03",C621_WSHAPEFB03list);

        Collections.reverse(C621_WSHAPEFB04list);
        map.put("C621_WSHAPEFB04",C621_WSHAPEFB04list);

        Collections.reverse(C621_WSHAPEFB05list);
        map.put("C621_WSHAPEFB05",C621_WSHAPEFB05list);

        Collections.reverse(C621_WSHAPEFB06list);
        map.put("C621_WSHAPEFB06",C621_WSHAPEFB06list);

        Collections.reverse(C621_WSHAPEFB07list);
        map.put("C621_WSHAPEFB07",C621_WSHAPEFB07list);

        Collections.reverse(C621_WSHAPEFB08list);
        map.put("C621_WSHAPEFB08",C621_WSHAPEFB08list);

        Collections.reverse(C621_WSHAPEFB09list);
        map.put("C621_WSHAPEFB09",C621_WSHAPEFB09list);

        Collections.reverse(C621_WSHAPEFB10list);
        map.put("C621_WSHAPEFB10",C621_WSHAPEFB10list);

        Collections.reverse(C621_WSHAPEFB11list);
        map.put("C621_WSHAPEFB11",C621_WSHAPEFB11list);

        Collections.reverse(C621_WSHAPEFB12list);
        map.put("C621_WSHAPEFB12",C621_WSHAPEFB12list);

        Collections.reverse(C621_WSHAPEFB13list);
        map.put("C621_WSHAPEFB13",C621_WSHAPEFB13list);

        Collections.reverse(C621_WSHAPEFB14list);
        map.put("C621_WSHAPEFB14",C621_WSHAPEFB14list);

        Collections.reverse(C621_WSHAPEFB15list);
        map.put("C621_WSHAPEFB15",C621_WSHAPEFB15list);

        Collections.reverse(C621_WSHAPEFB16list);
        map.put("C621_WSHAPEFB16",C621_WSHAPEFB16list);

        Collections.reverse(C621_WSHAPEFB17list);
        map.put("C621_WSHAPEFB17",C621_WSHAPEFB17list);

        Collections.reverse(C621_WSHAPEFB18list);
        map.put("C621_WSHAPEFB18",C621_WSHAPEFB18list);

        Collections.reverse(C621_WSHAPEFB19list);
        map.put("C621_WSHAPEFB19",C621_WSHAPEFB19list);

        Collections.reverse(C621_WSHAPEFB20list);
        map.put("C621_WSHAPEFB20",C621_WSHAPEFB20list);

        Collections.reverse(C621_WSHAPEFB21list);
        map.put("C621_WSHAPEFB21",C621_WSHAPEFB21list);

        Collections.reverse(C621_WSHAPEFB22list);
        map.put("C621_WSHAPEFB22",C621_WSHAPEFB22list);

        Collections.reverse(C621_WSHAPEFB23list);
        map.put("C621_WSHAPEFB23",C621_WSHAPEFB23list);

        Collections.reverse(C621_WSHAPEFB24list);
        map.put("C621_WSHAPEFB24",C621_WSHAPEFB24list);

        Collections.reverse(C621_WSHAPEFB25list);
        map.put("C621_WSHAPEFB25",C621_WSHAPEFB25list);

        Collections.reverse(C621_WSHAPEFB26list);
        map.put("C621_WSHAPEFB26",C621_WSHAPEFB26list);

        Collections.reverse(C621_WSHAPEFB27list);
        map.put("C621_WSHAPEFB27",C621_WSHAPEFB27list);

        Collections.reverse(C621_WSHAPEFB28list);
        map.put("C621_WSHAPEFB28",C621_WSHAPEFB28list);

        Collections.reverse(C621_WSHAPEFB29list);
        map.put("C621_WSHAPEFB29",C621_WSHAPEFB29list);

        Collections.reverse(C621_WSHAPEFB30list);
        map.put("C621_WSHAPEFB30",C621_WSHAPEFB30list);

        Collections.reverse(C621_WSHAPEFB31list);
        map.put("C621_WSHAPEFB31",C621_WSHAPEFB31list);

        Collections.reverse(C621_WSHAPEFB32list);
        map.put("C621_WSHAPEFB32",C621_WSHAPEFB32list);

        Collections.reverse(C621_WSHAPEFB33list);
        map.put("C621_VM_MDV_01_4VFB",C621_WSHAPEFB33list);
        log.info("数据查询成功");

        return ResultData.ResultDataFaultSelf("操作成功", map);
    }

    /**
     * 获取2130时间序列
     * @param json
     * @return
     */
    public ResultData get2130TimeSeriesData(JSONObject json) {
        // 获取coil_id
        String coil_id = json.getString("coil_id");

        // 创建查询条件 传入coil_id和表中数据相同的满足条件
        LambdaQueryWrapper<TbDsjC622FlatPassTime> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(TbDsjC622FlatPassTime::getCoil_id, coil_id);

        // 调用dao方法进行查询
        List<TbDsjC622FlatPassTime> tbDsjC622FlatPassTimeList = tbDsjC622FlatPassTimeMapper.selectList(queryWrapper);

        // 获取sdkUtils连接
        HDDataConnection dataConn = sdkUtils.getConnect();
        while (!dataConn.isConnected()) {
            dataConn = sdkUtils.getConnect();
        }
        // findTagId 根据变量名查找tagId
        Integer tagId = sdkUtils.findTagId("C622_WDSHX5D2", dataConn.getTagManager());

        Integer tagId1 = sdkUtils.findTagId("C622_WDSHX5D1", dataConn.getTagManager());
        Integer tagIdY = sdkUtils.findTagId("C622_WX5D2XRAYAI", dataConn.getTagManager());

        Integer tagId2 = sdkUtils.findTagId("C622_WX5D1XRAYAI", dataConn.getTagManager());
        Integer tagId3 = sdkUtils.findTagId("C622_WSHAPEFB01", dataConn.getTagManager());
        Integer tagId4 = sdkUtils.findTagId("C622_WSHAPEFB02", dataConn.getTagManager());
        Integer tagId5 = sdkUtils.findTagId("C622_WSHAPEFB03", dataConn.getTagManager());
        Integer tagId6 = sdkUtils.findTagId("C622_WSHAPEFB04", dataConn.getTagManager());
        Integer tagId7 = sdkUtils.findTagId("C622_WSHAPEFB05", dataConn.getTagManager());
        Integer tagId8 = sdkUtils.findTagId("C622_WSHAPEFB06", dataConn.getTagManager());
        Integer tagId9 = sdkUtils.findTagId("C622_WSHAPEFB07", dataConn.getTagManager());
        Integer tagId10 = sdkUtils.findTagId("C622_WSHAPEFB08", dataConn.getTagManager());
        Integer tagId11 = sdkUtils.findTagId("C622_WSHAPEFB09", dataConn.getTagManager());
        Integer tagId12 = sdkUtils.findTagId("C622_WSHAPEFB10", dataConn.getTagManager());
        Integer tagId13 = sdkUtils.findTagId("C622_WSHAPEFB11", dataConn.getTagManager());
        Integer tagId14 = sdkUtils.findTagId("C622_WSHAPEFB12", dataConn.getTagManager());
        Integer tagId15 = sdkUtils.findTagId("C622_WSHAPEFB13", dataConn.getTagManager());
        Integer tagId16 = sdkUtils.findTagId("C622_WSHAPEFB14", dataConn.getTagManager());
        Integer tagId17 = sdkUtils.findTagId("C622_WSHAPEFB15", dataConn.getTagManager());
        Integer tagId18 = sdkUtils.findTagId("C622_WSHAPEFB16", dataConn.getTagManager());
        Integer tagId19 = sdkUtils.findTagId("C622_WSHAPEFB17", dataConn.getTagManager());
        Integer tagId20 = sdkUtils.findTagId("C622_WSHAPEFB18", dataConn.getTagManager());
        Integer tagId21 = sdkUtils.findTagId("C622_WSHAPEFB19", dataConn.getTagManager());
        Integer tagId22 = sdkUtils.findTagId("C622_WSHAPEFB20", dataConn.getTagManager());
        Integer tagId23 = sdkUtils.findTagId("C622_WSHAPEFB21", dataConn.getTagManager());
        Integer tagId24 = sdkUtils.findTagId("C622_WSHAPEFB22", dataConn.getTagManager());
        Integer tagId25 = sdkUtils.findTagId("C622_WSHAPEFB23", dataConn.getTagManager());
        Integer tagId26 = sdkUtils.findTagId("C622_WSHAPEFB24", dataConn.getTagManager());
        Integer tagId27 = sdkUtils.findTagId("C622_WSHAPEFB25", dataConn.getTagManager());
        Integer tagId28 = sdkUtils.findTagId("C622_WSHAPEFB26", dataConn.getTagManager());
        Integer tagId29 = sdkUtils.findTagId("C622_WSHAPEFB27", dataConn.getTagManager());
        Integer tagId30 = sdkUtils.findTagId("C622_WSHAPEFB28", dataConn.getTagManager());
        Integer tagId31 = sdkUtils.findTagId("C622_WSHAPEFB29", dataConn.getTagManager());
        Integer tagId32 = sdkUtils.findTagId("C622_WSHAPEFB30", dataConn.getTagManager());
        Integer tagId33 = sdkUtils.findTagId("C622_WSHAPEFB31", dataConn.getTagManager());
        Integer tagId34 = sdkUtils.findTagId("C622_WSHAPEFB32", dataConn.getTagManager());
        Integer tagId35 = sdkUtils.findTagId("C622_WSHAPEFB33", dataConn.getTagManager());
        Integer tagId36 = sdkUtils.findTagId("C622_WSHAPEFB34", dataConn.getTagManager());
        Integer tagId37 = sdkUtils.findTagId("C622_WSHAPEFB35", dataConn.getTagManager());
        Integer tagId38 = sdkUtils.findTagId("C622_WSHAPEFB36", dataConn.getTagManager());
        Integer tagId39 = sdkUtils.findTagId("C622_WSHAPEFB37", dataConn.getTagManager());
        Integer tagId40 = sdkUtils.findTagId("C622_WSHAPEFB38", dataConn.getTagManager());
        Integer tagId41 = sdkUtils.findTagId("C622_WSHAPEFB39", dataConn.getTagManager());
        Integer tagId42 = sdkUtils.findTagId("C622_WSHAPEFB40", dataConn.getTagManager());
        Integer tagId43 = sdkUtils.findTagId("C622_N11D01", dataConn.getTagManager());


        List<Double> C622_WDSHX5D2List = new ArrayList<>();

        List<Double> C622_WDSHX5D1List = new ArrayList<>();
        List<Double> C622_WX5D2XRAYAIList = new ArrayList<>();

        List<Double> C622_WX5D1XRAYAIList = new ArrayList<>();
        List<Double> C622_WSHAPEFB01List = new ArrayList<>();
        List<Double> C622_WSHAPEFB02List = new ArrayList<>();
        List<Double> C622_WSHAPEFB03List = new ArrayList<>();
        List<Double> C622_WSHAPEFB04List = new ArrayList<>();
        List<Double> C622_WSHAPEFB05List = new ArrayList<>();
        List<Double> C622_WSHAPEFB06List = new ArrayList<>();
        List<Double> C622_WSHAPEFB07List = new ArrayList<>();
        List<Double> C622_WSHAPEFB08List = new ArrayList<>();
        List<Double> C622_WSHAPEFB09List = new ArrayList<>();
        List<Double> C622_WSHAPEFB10List = new ArrayList<>();
        List<Double> C622_WSHAPEFB11List = new ArrayList<>();
        List<Double> C622_WSHAPEFB12List = new ArrayList<>();
        List<Double> C622_WSHAPEFB13List = new ArrayList<>();
        List<Double> C622_WSHAPEFB14List = new ArrayList<>();
        List<Double> C622_WSHAPEFB15List = new ArrayList<>();
        List<Double> C622_WSHAPEFB16List = new ArrayList<>();
        List<Double> C622_WSHAPEFB17List = new ArrayList<>();
        List<Double> C622_WSHAPEFB18List = new ArrayList<>();
        List<Double> C622_WSHAPEFB19List = new ArrayList<>();
        List<Double> C622_WSHAPEFB20List = new ArrayList<>();
        List<Double> C622_WSHAPEFB21List = new ArrayList<>();
        List<Double> C622_WSHAPEFB22List = new ArrayList<>();
        List<Double> C622_WSHAPEFB23List = new ArrayList<>();
        List<Double> C622_WSHAPEFB24List = new ArrayList<>();
        List<Double> C622_WSHAPEFB25List = new ArrayList<>();
        List<Double> C622_WSHAPEFB26List = new ArrayList<>();
        List<Double> C622_WSHAPEFB27List = new ArrayList<>();
        List<Double> C622_WSHAPEFB28List = new ArrayList<>();
        List<Double> C622_WSHAPEFB29List = new ArrayList<>();
        List<Double> C622_WSHAPEFB30List = new ArrayList<>();
        List<Double> C622_WSHAPEFB31List = new ArrayList<>();
        List<Double> C622_WSHAPEFB32List = new ArrayList<>();
        List<Double> C622_WSHAPEFB33List = new ArrayList<>();
        List<Double> C622_WSHAPEFB34List = new ArrayList<>();
        List<Double> C622_WSHAPEFB35List = new ArrayList<>();
        List<Double> C622_WSHAPEFB36List = new ArrayList<>();
        List<Double> C622_WSHAPEFB37List = new ArrayList<>();
        List<Double> C622_WSHAPEFB38List = new ArrayList<>();
        List<Double> C622_WSHAPEFB39List = new ArrayList<>();
        List<Double> C622_WSHAPEFB40List = new ArrayList<>();
        List<Double> C622_WSHAPEFB41List = new ArrayList<>();


        Map<String,Object> map = new HashMap<>();

        // 遍历tbDsjC621EdgePassTimeList集合拿到所有数据
        for (TbDsjC622FlatPassTime item : tbDsjC622FlatPassTimeList) {

            LocalDateTime startTime = item.getPass_device_start_time().toLocalDateTime();
            LocalDateTime endTime = item.getPass_device_end_time().toLocalDateTime();

            map.put("start_time",startTime);
            map.put("end_Time",endTime);
            HDErrcode hdErrcode = new HDErrcode();

            // findMsgByIdAndTime 查询一段时间内 对应tagID的值
            C622_WDSHX5D2List = sdkUtils.findQueryTagHisInterRecords(tagId, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WDSHX5D1List = sdkUtils.findQueryTagHisInterRecords(tagId1, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WX5D2XRAYAIList = sdkUtils.findQueryTagHisInterRecords(tagIdY, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);

            C622_WX5D1XRAYAIList = sdkUtils.findQueryTagHisInterRecords(tagId2, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB01List = sdkUtils.findQueryTagHisInterRecords(tagId3, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB02List = sdkUtils.findQueryTagHisInterRecords(tagId4, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB03List = sdkUtils.findQueryTagHisInterRecords(tagId5, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB04List = sdkUtils.findQueryTagHisInterRecords(tagId6, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB05List = sdkUtils.findQueryTagHisInterRecords(tagId7, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB06List = sdkUtils.findQueryTagHisInterRecords(tagId8, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB07List = sdkUtils.findQueryTagHisInterRecords(tagId9, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB08List = sdkUtils.findQueryTagHisInterRecords(tagId10, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB09List = sdkUtils.findQueryTagHisInterRecords(tagId11, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB10List = sdkUtils.findQueryTagHisInterRecords(tagId12, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB11List = sdkUtils.findQueryTagHisInterRecords(tagId13, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB12List = sdkUtils.findQueryTagHisInterRecords(tagId14, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB13List = sdkUtils.findQueryTagHisInterRecords(tagId15, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB14List = sdkUtils.findQueryTagHisInterRecords(tagId16, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB15List = sdkUtils.findQueryTagHisInterRecords(tagId17, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB16List = sdkUtils.findQueryTagHisInterRecords(tagId18, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB17List = sdkUtils.findQueryTagHisInterRecords(tagId19, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB18List = sdkUtils.findQueryTagHisInterRecords(tagId20, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB19List = sdkUtils.findQueryTagHisInterRecords(tagId21, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB20List = sdkUtils.findQueryTagHisInterRecords(tagId22, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB21List = sdkUtils.findQueryTagHisInterRecords(tagId23, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB22List = sdkUtils.findQueryTagHisInterRecords(tagId24, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB23List = sdkUtils.findQueryTagHisInterRecords(tagId25, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB24List = sdkUtils.findQueryTagHisInterRecords(tagId26, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB25List = sdkUtils.findQueryTagHisInterRecords(tagId27, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB26List = sdkUtils.findQueryTagHisInterRecords(tagId28, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB27List = sdkUtils.findQueryTagHisInterRecords(tagId29, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB28List = sdkUtils.findQueryTagHisInterRecords(tagId30, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB29List = sdkUtils.findQueryTagHisInterRecords(tagId31, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB30List = sdkUtils.findQueryTagHisInterRecords(tagId32, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB31List = sdkUtils.findQueryTagHisInterRecords(tagId33, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB32List = sdkUtils.findQueryTagHisInterRecords(tagId34, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB33List = sdkUtils.findQueryTagHisInterRecords(tagId35, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB34List = sdkUtils.findQueryTagHisInterRecords(tagId36, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB35List = sdkUtils.findQueryTagHisInterRecords(tagId37, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB36List = sdkUtils.findQueryTagHisInterRecords(tagId38, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB37List = sdkUtils.findQueryTagHisInterRecords(tagId39, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB38List = sdkUtils.findQueryTagHisInterRecords(tagId40, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB39List = sdkUtils.findQueryTagHisInterRecords(tagId41, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB40List = sdkUtils.findQueryTagHisInterRecords(tagId42, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
            C622_WSHAPEFB41List = sdkUtils.findQueryTagHisInterRecords(tagId43, dataConn.getDataProvider(), startTime, endTime,1000, hdErrcode);
        }
        Collections.reverse(C622_WDSHX5D2List);
        map.put("C622_WDSHX5D2",C622_WDSHX5D2List);

        Collections.reverse(C622_WDSHX5D1List);
        map.put("C622_WDSHX5D1",C622_WDSHX5D1List);

        Collections.reverse(C622_WX5D2XRAYAIList);
        map.put("C622_WX5D2XRAYAI",C622_WX5D2XRAYAIList);

        Collections.reverse(C622_WX5D1XRAYAIList);
        map.put("C622_WX5D1XRAYAI",C622_WX5D1XRAYAIList);

        Collections.reverse(C622_WSHAPEFB01List);
        map.put("C622_WSHAPEFB01",C622_WSHAPEFB01List);

        Collections.reverse(C622_WSHAPEFB02List);
        map.put("C622_WSHAPEFB02",C622_WSHAPEFB02List);

        Collections.reverse(C622_WSHAPEFB03List);
        map.put("C622_WSHAPEFB03",C622_WSHAPEFB03List);

        Collections.reverse(C622_WSHAPEFB04List);
        map.put("C622_WSHAPEFB04",C622_WSHAPEFB04List);

        Collections.reverse(C622_WSHAPEFB05List);
        map.put("C622_WSHAPEFB05",C622_WSHAPEFB05List);

        Collections.reverse(C622_WSHAPEFB06List);
        map.put("C622_WSHAPEFB06",C622_WSHAPEFB06List);

        Collections.reverse(C622_WSHAPEFB07List);
        map.put("C622_WSHAPEFB07",C622_WSHAPEFB07List);

        Collections.reverse(C622_WSHAPEFB08List);
        map.put("C622_WSHAPEFB08",C622_WSHAPEFB08List);

        Collections.reverse(C622_WSHAPEFB09List);
        map.put("C622_WSHAPEFB09",C622_WSHAPEFB09List);

        Collections.reverse(C622_WSHAPEFB10List);
        map.put("C622_WSHAPEFB10",C622_WSHAPEFB10List);

        Collections.reverse(C622_WSHAPEFB11List);
        map.put("C622_WSHAPEFB11",C622_WSHAPEFB11List);

        Collections.reverse(C622_WSHAPEFB12List);
        map.put("C622_WSHAPEFB12",C622_WSHAPEFB12List);

        Collections.reverse(C622_WSHAPEFB13List);
        map.put("C622_WSHAPEFB13",C622_WSHAPEFB13List);

        Collections.reverse(C622_WSHAPEFB14List);
        map.put("C622_WSHAPEFB14",C622_WSHAPEFB14List);

        Collections.reverse(C622_WSHAPEFB15List);
        map.put("C622_WSHAPEFB15",C622_WSHAPEFB15List);

        Collections.reverse(C622_WSHAPEFB16List);
        map.put("C622_WSHAPEFB16",C622_WSHAPEFB16List);

        Collections.reverse(C622_WSHAPEFB17List);
        map.put("C622_WSHAPEFB17",C622_WSHAPEFB17List);

        Collections.reverse(C622_WSHAPEFB18List);
        map.put("C622_WSHAPEFB18",C622_WSHAPEFB18List);

        Collections.reverse(C622_WSHAPEFB19List);
        map.put("C622_WSHAPEFB19",C622_WSHAPEFB19List);

        Collections.reverse(C622_WSHAPEFB20List);
        map.put("C622_WSHAPEFB20",C622_WSHAPEFB20List);

        Collections.reverse(C622_WSHAPEFB21List);
        map.put("C622_WSHAPEFB21",C622_WSHAPEFB21List);

        Collections.reverse(C622_WSHAPEFB22List);
        map.put("C622_WSHAPEFB22",C622_WSHAPEFB22List);

        Collections.reverse(C622_WSHAPEFB23List);
        map.put("C622_WSHAPEFB23",C622_WSHAPEFB23List);

        Collections.reverse(C622_WSHAPEFB24List);
        map.put("C622_WSHAPEFB24",C622_WSHAPEFB24List);

        Collections.reverse(C622_WSHAPEFB25List);
        map.put("C622_WSHAPEFB25",C622_WSHAPEFB25List);

        Collections.reverse(C622_WSHAPEFB26List);
        map.put("C622_WSHAPEFB26",C622_WSHAPEFB26List);

        Collections.reverse(C622_WSHAPEFB27List);
        map.put("C622_WSHAPEFB27",C622_WSHAPEFB27List);

        Collections.reverse(C622_WSHAPEFB28List);
        map.put("C622_WSHAPEFB28",C622_WSHAPEFB28List);

        Collections.reverse(C622_WSHAPEFB29List);
        map.put("C622_WSHAPEFB29",C622_WSHAPEFB29List);

        Collections.reverse(C622_WSHAPEFB30List);
        map.put("C622_WSHAPEFB30",C622_WSHAPEFB30List);

        Collections.reverse(C622_WSHAPEFB31List);
        map.put("C622_WSHAPEFB31",C622_WSHAPEFB31List);

        Collections.reverse(C622_WSHAPEFB32List);
        map.put("C622_WSHAPEFB32",C622_WSHAPEFB32List);

        Collections.reverse(C622_WSHAPEFB33List);
        map.put("C622_WSHAPEFB33",C622_WSHAPEFB33List);

        Collections.reverse(C622_WSHAPEFB34List);
        map.put("C622_WSHAPEFB34",C622_WSHAPEFB34List);

        Collections.reverse(C622_WSHAPEFB35List);
        map.put("C622_WSHAPEFB35",C622_WSHAPEFB35List);

        Collections.reverse(C622_WSHAPEFB36List);
        map.put("C622_WSHAPEFB36",C622_WSHAPEFB36List);

        Collections.reverse(C622_WSHAPEFB37List);
        map.put("C622_WSHAPEFB37",C622_WSHAPEFB37List);

        Collections.reverse(C622_WSHAPEFB38List);
        map.put("C622_WSHAPEFB38",C622_WSHAPEFB38List);

        Collections.reverse(C622_WSHAPEFB39List);
        map.put("C622_WSHAPEFB39",C622_WSHAPEFB39List);

        Collections.reverse(C622_WSHAPEFB40List);
        map.put("C622_WSHAPEFB40",C622_WSHAPEFB40List);

        Collections.reverse(C622_WSHAPEFB41List);
        map.put("C622_N11D01",C622_WSHAPEFB41List);
        log.info("数据查询成功");

        return ResultData.ResultDataFaultSelf("操作成功", map);
    }
}